:: @echo off
setlocal enabledelayedexpansion

for /f %%a in ('powershell -NoLogo -NoProfile -Command "Get-Date -Format yyyyMMdd"') do set TODAY=%%a


set DIR=D:\study\bat

set FILE=%DIR%\%TODAY%.flag


if not exist "%FILE%" (

(
	chcp 65001 >nul
    echo ===== %date% %time% =====
	cd /d D:\study\SourceStudy
	git fetch --all
	git reset --hard origin/master
	cd /d C:\Users\dl\AppData\Roaming\JetBrains\IntelliJIdea2025.1\workspace
	git fetch --all
	git reset --hard origin/master
) >> D:\study\bat\auto-git.log 2>&1
cd /d D:\study\bat
del *.flag
echo [%date% %time%] created > "%FILE%"

)
echo [%date% %time%] pull canceled >> D:\study\bat\auto-git.log

endlocal